﻿namespace Sai.Test.Sandcastle
{
    using Sai.Core.Sandcastle;
    using Sai.Test.XUnit;
    using Xunit;

	public class TopicFacts
	{
		public class TheChildTopicIdsProperty
		{
			
			[Fact, InMemoryTest]
			public void Returns_Flat_List_For_Topic_Tree()
			{
				Topic topLevel = new Topic("01234", "Top");
				Topic first = new Topic("12345", "First");
				Topic second = new Topic("23456", "Second");
				Topic third = new Topic("34567", "Third");
				Topic fourth = new Topic("45678", "Fourth");
				Topic fifth = new Topic("56789", "Fifth");

				topLevel.Add(first);

				third.Add(fourth);
				third.Add(fifth);

				second.Add(third);

				topLevel.Add(second);

				var idList = topLevel.FlatTopicIds;

				Assert.Equal(6, idList.Count);
				Assert.Contains("01234", idList);
				Assert.Contains("12345", idList);
				Assert.Contains("23456", idList);
				Assert.Contains("34567", idList);
				Assert.Contains("45678", idList);
				Assert.Contains("56789", idList);
			}
		}
	}
}
